#include "align_formats.h"
#include "index_string.h"
#include <boost/algorithm/string.hpp>
#include <stdexcept>

namespace bcpp_align
{
using std::string;

//8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888

//	select_matrix_file_format

//8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
eALIGN_MATRIX_TYPE  select_align_matrix_format(const string& matrix_type_str)
{
	// not the fastest / most efficient way of doing this
	// but nice and elegant for rarely run code
	t_index_string format_strs;
	format_strs.index("DNA");
	format_strs.index("BLOSUM62");
	format_strs.index("BLOSUM80");
	format_strs.index("62");
	format_strs.index("80");

	// case insensitive match
	string matrix_type_str_lc =  boost::algorithm::to_upper_copy(matrix_type_str);
	if (!format_strs.is_indexed(matrix_type_str_lc))
		throw (std::logic_error(
								"The alignment matrix type data format must be one of \n"
								"\tdna\n"
								"\tblosum62\n"
								"\tblosum80\n"
								"(rather than [" + matrix_type_str +  "]"));
	return eALIGN_MATRIX_TYPE(format_strs.index(matrix_type_str_lc));
	
}

};



